#include "MovieRental.h"
#include "gtest/gtest.h"

TEST(test_demo, get_output_text) {
    Movie regular("zhanlang1", Movie::REGULAR);
    Movie newrelease("zhanlang2", Movie::NEW_RELEASE);
    Rental rental(regular, 3);
    Rental rental2(newrelease, 1);
    Customer customer("Jason");
    customer.AddRental(rental);
    customer.AddRental(rental2);

    customer.UpdateCustomerData();
    std::string detailBills = customer.statement();
    std::string expect =
        "Rental Record for Jason\n\tzhanlang1\t3.5\n\tzhanlang2\t3\nAmount "
        "owed is 6.5\nYou earned 2 frequent renter points";
    ASSERT_TRUE(detailBills.compare(expect) == 0);
}

TEST(test_demo, get_output_html) {
    Movie regular("zhanlang1", Movie::REGULAR);
    Movie newrelease("zhanlang2", Movie::NEW_RELEASE);
    Rental rental(regular, 3);
    Rental rental2(newrelease, 1);
    Customer customer("Jason");
    customer.AddRental(rental);
    customer.AddRental(rental2);

    customer.UpdateCustomerData();
    std::string detailBills = customer.GetOutputHtml();

    std::string expect =
        "<h1>Rental Record for "
        "<em>Jason</em></h1>\n<table>\n\t<tr><td>zhanlang1</td><td>3.5</td></"
        "tr>\n\t<tr><td>zhanlang2</td><td>3</td></tr>\n</table>\n<p>Amount "
        "owed is <em>6.5</em></p>\n<p>You earned <em>2</em> frequent renter "
        "points</p>";
    ASSERT_TRUE(detailBills.compare(expect) == 0);
}